package cn.accjiyun.inventory.model;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import java.sql.Date;

/**
 * Created by jiyun on 2016/7/4.
 */
@Entity
public class Storage {
    private String id;
    private String goodsId;
    private String supplierId;
    private Integer number;
    private Double offerPrice;
    private Date data;
    private String operator;

    @Id
    @Column(name = "id", nullable = false, length = 8)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "goodsId", nullable = false, length = 8)
    public String getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(String goodsId) {
        this.goodsId = goodsId;
    }

    @Basic
    @Column(name = "supplierId", nullable = false, length = 8)
    public String getSupplierId() {
        return supplierId;
    }

    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }

    @Basic
    @Column(name = "number", nullable = true)
    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    @Basic
    @Column(name = "offerPrice", nullable = true, precision = 0)
    public Double getOfferPrice() {
        return offerPrice;
    }

    public void setOfferPrice(Double offerPrice) {
        this.offerPrice = offerPrice;
    }

    @Basic
    @Column(name = "data", nullable = false)
    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    @Basic
    @Column(name = "operator", nullable = false, length = 10)
    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Storage storage = (Storage) o;

        if (id != null ? !id.equals(storage.id) : storage.id != null) return false;
        if (goodsId != null ? !goodsId.equals(storage.goodsId) : storage.goodsId != null) return false;
        if (supplierId != null ? !supplierId.equals(storage.supplierId) : storage.supplierId != null) return false;
        if (number != null ? !number.equals(storage.number) : storage.number != null) return false;
        if (offerPrice != null ? !offerPrice.equals(storage.offerPrice) : storage.offerPrice != null) return false;
        if (data != null ? !data.equals(storage.data) : storage.data != null) return false;
        if (operator != null ? !operator.equals(storage.operator) : storage.operator != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (goodsId != null ? goodsId.hashCode() : 0);
        result = 31 * result + (supplierId != null ? supplierId.hashCode() : 0);
        result = 31 * result + (number != null ? number.hashCode() : 0);
        result = 31 * result + (offerPrice != null ? offerPrice.hashCode() : 0);
        result = 31 * result + (data != null ? data.hashCode() : 0);
        result = 31 * result + (operator != null ? operator.hashCode() : 0);
        return result;
    }
}
